package com.dragon.logical.service.contract.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dragon.logical.service.contract.IContractFitService;
import com.dragon.repository.entity.ContractFit;
import com.dragon.repository.mapper.ContractFitMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 合同设置 服务实现类
 * </p>
 *
 * @author sy
 * @since 2023-11-08
 */
@Service
public class ContractFitServiceImpl extends ServiceImpl<ContractFitMapper, ContractFit> implements IContractFitService {

    @Autowired
    ContractFitMapper fitMapper;

    @Override
    public void updateFit(ContractFit fit) {
        ContractFit contractFit = fitMapper.selectById(fit.getId());
        if (contractFit != null){
            fitMapper.updateById(fit);
        } else {
            fitMapper.insert(fit);
        }
    }

    @Override
    public ContractFit detailOne(Integer id) {
        ContractFit contractFit = fitMapper.selectDetail(id);
        return contractFit;
    }
}

